<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/static/bootstrap.min.css">
    <script src="/static/js/jquery-2.2.4.js"></script>
    <script>

        $(function(){

            $("#btn").click(function(){
               // document.getElementById("username").value;
                $.get("/doLogin1?username="
                    +$("#username").val()+"&password="+$("#password").val(),function(r){
                    if(r.code==0){
                        location.href="success.html";
                    }else{
                        $("#errorMsg").html(r.msg);
                    }
                });

            });

        });

    </script>
</head>
<body>

    <H1>登录</H1>
    <form id="myForm" >
        <div>
            <label>
                用户名
            </label>
            <input id="username" type="text" name="username" class="form-control" >
        </div>
        <div>
            <label>
                密码
            </label>
            <input id="password" type="text" name="password" class="form-control">
        </div>
        <span style="color: red" id="errorMsg"></span>
        <div>
            <input type="button" id="btn" value="登录" class="btn btn-success">
        </div>
    </form>
</body>
</html>